import { GTextFiled } from "../../../../../../com/mui/controls/GTextFiled";
import { GlobalClass } from "../../../../../../com/mui/core/GlobalClass";
import { ObjectPool } from "../../../../../../com/gengine/utils/pools/ObjectPool";
import { FlyFootBmp } from "../../../mapUI/flyFoot/FlyFootBmp";
import { AIManager } from "../../../../scene/ai/AIManager";
import { Cache } from "../../../../cache/Cache";
import { ENpcEffect } from "../../../../../../Message/Public/ENpcEffect";
import { AIType } from "../../../../scene/ai/AIType";
import { Dispatcher } from "../../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../../events/DataEvent";
import { ObjCreate } from "../../../common/ObjCreate";
import { ImagesConst } from "../../../../resource/ImagesConst";
//class RuneGetSubWin
    
    export  class RuneGetSubWin /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._icon1 = new Object /* flash.display.Bitmap */();
            this._icon2 = new Object /* flash.display.Bitmap */();
            this._txtLink = new GTextFiled();
            this._txtDesc = new GTextFiled();
            this.initView();
            return;
        }

        public updateView(arg1: string, arg2: string, arg3: string, arg4: string): void
        {
            this._icon1.bitmapData = GlobalClass.getBitmapData(arg1);
            this._icon2.bitmapData = GlobalClass.getBitmapData(arg2);
            this._icon2.x = (123 - this._icon2.width) / 2;
            this._txtLink.htmlText = arg3;
            this._txtDesc.htmlText = arg4;
            this._txtLink.addEventListener(flash.events.TextEvent.LINK, this.clickLinkHandler);
            return;
        }

        public showFlyFoot(): void
        {
            if (this._flyFoot == null) 
            {
                this._flyFoot = ObjectPool.getObject(FlyFootBmp);
                this._flyFoot.x = 92;
                this._flyFoot.y = 119;
                this.addChild(this._flyFoot);
                this._flyFoot.addEventListener(flash.events.MouseEvent.CLICK, this.onFlyTransport);
            }
            return;
        }

        /* internal  */onFlyTransport(arg1: Object /* flash.events.MouseEvent */): void
        {
            AIManager.onAIControl(Cache.instance.scene.getNpcByEffect(ENpcEffect._ENpcEffectMeritExchange), AIType.AI_Convey);
            return;
        }

        /* internal  */clickLinkHandler(arg1: Object /* flash.events.TextEvent */): void
        {
            arg1.stopImmediatePropagation();
            Dispatcher.dispatchEvent(new DataEvent(arg1.text));
            return;
        }

        /* internal  */initView(): void
        {
            ObjCreate.createBg(0, 0, 127, 262, this);
            ObjCreate.createBitmap(ImagesConst.PropBg, 30, 13, this);
            this._icon1 = new Object /* flash.display.Bitmap */();
            this._icon1.x = 35;
            this._icon1.y = 18;
            this.addChild(this._icon1);
            this._icon2 = new Object /* flash.display.Bitmap */();
            this._icon2.x = 21;
            this._icon2.y = 89;
            this.addChild(this._icon2);
            this._txtLink = ObjCreate.createGTextField("", 40, 120, 200, 20, this);
            this._txtLink.textColor = 65280;
            ObjCreate.createBg(10, 143, 106, 1, this, ImagesConst.SplitLine);
            this._txtDesc = ObjCreate.createGTextField("", 14, 150, 106, 160, this);
            var loc1=this._txtDesc.defaultTextFormat;
            loc1.leading = 6;
            this._txtDesc.defaultTextFormat = loc1;
            this._txtDesc.wordWrap = true;
            this._txtDesc.multiline = true;
            return;
        }

        /* internal */ /* var */_icon1: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_icon2: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_txtLink: GTextFiled;

        /* internal */ /* var */_txtDesc: GTextFiled;

        /* internal */ /* var */_flyFoot: FlyFootBmp;

        /* internal */ /* var */_eventStr: string;
    }
